﻿@model MyUrnaVirtual.Models.AdminCandidatosViewModel

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>AdminCandidatos</h2>
<table class="pure-table" style="color:white;">
    <thead>
        <tr>
            <th style="color:darkblue;">
                Nombre
                @Html.DisplayFor(x => x.NombreCandidato)
            </th>

            <th style="color: darkred;">
                Apellido
                @Html.DisplayFor(x => x.NombreCandidato)
            </th>

            <th>
                Cantidad de Votos
            </th>
            <th>
                Imagen
            </th>
            <th>

            </th>

        </tr>
    </thead>
    <tbody>
        @using (var db = new MyUrnaVirtual.dbContext())
        {
            foreach (var cand in db.Candidatos)
            {
                <tr style="color:darkblue;">
                    <td>
                        @cand.nombre
                    </td>
                    <td>
                        @cand.apellido
                    </td>
                    <td>
                        @Model.cantVotos
                    </td>
                    <td>
                        <img src="@cand.imagen" style="max-width: 200px; height: auto;"/>
                    </td>
                    <td>
                        <button class="pure-button pure-button-primary" onclick="window.location.href='/AdminCandidatos/Editar?id=@cand.idCandidato'">Editar</button>
                        <button class="pure-button pure-button-error" onclick="window.location.href='/AdminCandidatos/Eliminar?id=@cand.idCandidato'">Eliminar</button>
                    </td>
                </tr>
            }
        }
    </tbody>



    <div align="center">
        <button class="pure-button pure-button-success" onclick="window.location.href='/AdminCandidatos/Crear'">Crear</button>
        
    </div>
</table>
